package com.example.springboottestgit.service.instruction.stage1;

import com.example.springboottestgit.bean.InstructData;
import com.example.springboottestgit.common.RunNum;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @description:追加采购金额
 * @author: ZZZ
 */
@Service
public class AddPurchaseAmount {
    static int n = 1;

    public List<InstructData> getInstructData() {
        List<InstructData> list = new ArrayList<>();
        for (int i = 1; i <= RunNum.a; i++) {
            list.add(mul(i % 2 == 0));
        }
        return list;
    }

    public InstructData mul(Boolean b) {
        Random random = new Random();
        int x = random.nextInt(10) + 1;
        if (b == true) {
            x = random.nextInt(20) + 10;
        }
        String sign = x <= 10 ? "符合" : "不符合";
        String e = x == 10 ? "等于" : "不等于";
        String r = x == 10 ? "对的" : "错误的";

        String instruction = "追加采购金额不得超过原合同采购金额的x%是否符合法律法规";
        String input = "";
        String output = "#。根据《中华人民共和国政府采购法》第四十九条的规定，追加采购金额不得超过原合同采购金额的10%，因此案例中追加采购金额不得超过原合同采购金额的x%#法律法规。";

        instruction = instruction.replace("x", x + "");
        output = output.replace("x", x + "").replace("#", sign + "").replace("e", e + "").replace("r", r + "");

        InstructData instructData = new InstructData();
        instructData.setInstruction(instruction);
        instructData.setInput("");
        instructData.setOutput(output);
        return instructData;
    }

}
